﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Iguana.Core.HypterText.Attributes
{
    public class charset : IAttribute
    {
           private bool m_Required = true;
        private string m_Name;
        private string m_Value;
        private AttributeDataType m_Type;
        private HTML4Compliance m_CompliancyCheck;

        public charset()
        {
            m_Name = "charset";

            // Use Iguana's CharSetResolver to get a character encoding name.
            m_Value = Iguana.Core.CharacterEncoding.CharSetResolver.GetName(CharacterEncoding.CSMIBenum.UTF8);

            m_Type = AttributeDataType.CHARACTERENCODING;
            m_Required = false;
            m_CompliancyCheck = UtilDocTypes.ReturnCommonSTF();
            
        }

        public bool Required
        {
            get
            {
                return m_Required;
            }
            set
            {
                m_Required = value;
            }
        }

        public string Name
        {
            get
            {
                return m_Name;
            }
            set
            {
                m_Name = value;
            }
        }

        public string Value
        {
            get
            {
                return m_Value;
            }
            set
            {
                m_Value = value;
            }
        }

        public AttributeDataType Type
        {
            get
            {
                return m_Type;
            }
            set
            {
                m_Type = value;
            }
        }

        public override string ToString()
        {
            return String.Format(SR.SR_ATTRIBUTE_NAME_VALUE_PAIR, Name, Value);
        }


        public HTML4Compliance CompiancyObject
        {
            get { return m_CompliancyCheck; }
        }


        // TODO: Possibly in the future, a list of acceptable Character Encodings can be incorporated through the use of Iguana.CharacterEncoding.
        public bool PreDefinedValues
        {
            get { return false; }
        }

        public List<string> AcceptableValues
        {
            get { return null; }
        }
    }
}
